<?php
pcntl_signal(SIGALRM,function (){
   echo "tick".PHP_EOL;
});
$tick = 1;
while (true){
    pcntl_alarm($tick);
    pcntl_signal_dispatch();
    sleep($tick);
}
